#include "src/aot-compiler/portable-bytecode-label.h"

#include "src/aot-compiler/portable-bytecode-array-builder.h"

namespace portable {

BytecodeLabel* BytecodeLabels::New() {
  P_DCHECK(!is_bound());
  labels_.emplace_back(BytecodeLabel());
  return &labels_.back();
}

void BytecodeLabels::Bind(BytecodeArrayBuilder* builder) {
  P_DCHECK(!is_bound_);
  is_bound_ = true;
  for (auto& label : labels_) {
    builder->Bind(&label);
  }
}

}  // namespace portable
